package id.net.iconpln.bb.server.dao.impl;

import id.net.iconpln.bb.server.dao.BbDao;
import id.net.iconpln.bb.server.model.persistence.ModelPerencanaaBb;
import id.net.iconpln.bb.server.model.persistence.MasterAllMembers;
import id.net.iconpln.bb.server.model.persistence.MasterJadwal;
import id.net.iconpln.bb.server.model.persistence.MasterModul;
import id.net.iconpln.bb.server.model.persistence.MasterPasokan;
import id.net.iconpln.bb.server.model.persistence.MasterPemasok;
import id.net.iconpln.bb.server.model.persistence.MasterPembangkit;
import id.net.iconpln.bb.server.model.persistence.MasterSurveyor;
import id.net.iconpln.bb.server.model.persistence.MasterTransportir;
import id.net.iconpln.bb.server.model.persistence.ModelPengendalianBb;
import id.net.iconpln.bb.server.model.persistence.RakorPKS;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import oracle.jdbc.OracleTypes;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository("bbDaoHibernate")
public class BbDaoHibernate implements BbDao{

	@Autowired
	private SessionFactory sessionFactory;


	@Override
	public List<MasterModul> getMasterModul() {
		// TODO Auto-generated method stub
		List<MasterModul> g = new ArrayList<MasterModul>();
		System.out.println("PACKAGE CRMREPORT.GETALLMODULE");
		try {
			
			Connection con = sessionFactory.getCurrentSession().connection();
			String sql = null;
			sql = "{? = call CRMREPORT.GETALLMODULE}";
			CallableStatement cst = con.prepareCall(sql);
			cst.registerOutParameter(1,OracleTypes.CURSOR);
			cst.execute();

			ResultSet rset = (ResultSet) cst.getObject(1);
			while (rset.next()) {
				MasterModul u = new MasterModul();
				u.setId_module(rset.getString("id_modul").toString());
				u.setKeterangan_modul(rset.getString("keterangan_modul").toString());
				g.add(u);
			}

		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return g;
	}

	@Override
	public List<MasterAllMembers> getListMasterBb(String codeMaster) {
		// TODO Auto-generated method stub
		List<MasterAllMembers> aa = new ArrayList<MasterAllMembers>();
		System.out.println("codeMaster: " + codeMaster);
		try {
			
			@SuppressWarnings("deprecation")
			Connection con = sessionFactory.getCurrentSession().connection();
			String sql = null;
			sql = "{? = call BBTRX.GETLISTMASTERBB(?)}";
			CallableStatement cst = con.prepareCall(sql);
			cst.setString(2, codeMaster);
			cst.registerOutParameter(1,OracleTypes.CURSOR);
			cst.execute();

			ResultSet rset = (ResultSet) cst.getObject(1);
			
			
			while (rset.next()) {
				if (codeMaster.equals("KIT")){
				System.out.println("kit dao");
				MasterAllMembers u = new MasterAllMembers();
				u.setId_pltu(rset.getBigDecimal("id_pltu").intValue());
				u.setNama_pembangkit(rset.getString("nama_pembangkit"));
				u.setNama_pic(rset.getString("nama_pic"));
				u.setAlamat(rset.getString("alamat"));
				u.setKepemilikan(rset.getString("kepemilikan"));
				u.setLatitude(rset.getString("latitude"));
				u.setLongitude(rset.getString("longitude"));
				u.setWilayah(rset.getString("wilayah"));
				u.setJenis_pembangkit(rset.getString("jenis_pembangkit"));
				u.setTelp(rset.getString("telp"));
				u.setDaya_terpasang(rset.getString("daya_terpasang"));
				u.setSfc(rset.getString("sfc"));
				u.setCapacity_factor(rset.getString("capacity_factor"));
				u.setHeat_rate(rset.getString("heat_rate"));
				u.setCreateby(rset.getString("createby"));
				u.setCreatedate(rset.getDate("createdate"));
				u.setUpdateby(rset.getString("updateby"));
				u.setUpdatedate(rset.getDate("updatedate"));
				u.setApp_access(rset.getString("app_access"));
				aa.add(u);
				}
				else if (codeMaster.equals("SURVEYOR")){
					System.out.println("surveyor dao");
					MasterAllMembers u = new MasterAllMembers();
					u.setId_surveyor(rset.getInt("id_surveyor"));
					u.setNama_surveyor(rset.getString("nama_surveyor"));
					System.out.println("nm surveyor: " + rset.getString("nama_surveyor"));
					u.setNo_kerjasama(rset.getString("no_kerjasama"));
					u.setTanggal(rset.getString("tanggal"));
					u.setTelp(rset.getString("telp"));
					u.setAlamat(rset.getString("alamat"));
					u.setPic(rset.getString("pic"));
					u.setKeterangan(rset.getString("keterangan"));
					u.setNo_kontrak(rset.getString("no_kontrak"));
					u.setCreateby(rset.getString("createby"));
					u.setCreatedate(rset.getDate("createdate"));
					u.setUpdateby(rset.getString("updateby"));
					u.setUpdatedate(rset.getDate("updatedate"));
					u.setApp_access(rset.getString("app_access"));
					aa.add(u);
					}
				else if (codeMaster.equals("TRANSPORTIR")){
					System.out.println("Transportir dao");
					MasterAllMembers u = new MasterAllMembers();
					u.setId_transportir(rset.getInt("id_transportir"));
					u.setNama_transportir(rset.getString("nama_transportir"));
					u.setAlamat(rset.getString("alamat").toString());
					u.setTelp(rset.getString("telp"));
					u.setPic(rset.getString("pic"));
					u.setNama_transport(rset.getString("nama_transport"));
					u.setJenis_transport(rset.getString("jenis_transport"));
					u.setKode_transport(rset.getString("kode_transport"));
					u.setJumlah_kapal(rset.getString("jumlah_kapal"));
					u.setSpec_kapal(rset.getString("spec_kapal"));
					u.setCreateby(rset.getString("createby"));
					u.setCreatedate(rset.getDate("createdate"));
					u.setUpdateby(rset.getString("updateby"));
					u.setUpdatedate(rset.getDate("updatedate"));
					u.setApp_access(rset.getString("app_access"));
					aa.add(u);
					}
				else if (codeMaster.equals("PEMASOK")){
					System.out.println("Pemasok dao");
					MasterAllMembers u = new MasterAllMembers();
					u.setId_pemasok(rset.getInt("id_pemasok"));
					System.out.println("id pemasok: " + rset.getInt("id_pemasok"));
					u.setPemasok(rset.getString("pemasok"));
					System.out.println("pemasok dao: " + rset.getString("pemasok"));
					u.setAlamat(rset.getString("alamat"));
					u.setPic_presdir(rset.getString("pic_presdir"));
					u.setPic_presdir_hp(rset.getString("pic_presdir_hp"));
					u.setPic_dir_marketing(rset.getString("pic_dir_marketing"));
					u.setPic_dir_marketing_hp(rset.getString("pic_dir_marketing_hp"));
					u.setPic_man_opr(rset.getString("pic_man_opr"));
					u.setPic_man_opr_hp(rset.getString("pic_man_opr_hp"));
					u.setStatus_pemasok(rset.getString("status_pemasok"));
					u.setNama_tambang(rset.getString("nama_tambang"));
					u.setProduksi(rset.getString("produksi"));
					u.setLoading_port(rset.getString("loading_port"));
					u.setFasilitas_loading(rset.getString("fasilitas_loading"));
					u.setJarak_hauling(rset.getString("jarak_hauling"));
					u.setFlag_blacklist(rset.getString("flag_blacklist"));
					u.setStatus_aktif(rset.getString("status_aktif"));
					u.setKeterangan(rset.getString("keterangan"));
					u.setCreateby(rset.getString("createby"));
					u.setCreatedate(rset.getDate("createdate"));
					u.setUpdateby(rset.getString("updateby"));
					u.setUpdatedate(rset.getDate("updatedate"));
					u.setApp_access(rset.getString("app_access"));
					u.setId_pusat(rset.getInt("id_pusat"));
					u.setStatus(rset.getString("status"));
					u.setTelp(rset.getString("tlp"));
					u.setFax(rset.getString("fax"));
					u.setEmail(rset.getString("email"));
					aa.add(u);
					}
			}
			
			
//			while (rset.next()) {
//				MasterAllMembers u = new MasterAllMembers();
//				u.setId_uraian(rset.getString("ID_URAIAN").toString());
//				u.setId_ch_uraian(rset.getString("ID_CH_URAIAN").toString());
//				u.setUraian(rset.getString("URAIAN").toString());
//				u.setSatuan(rset.getString("SATUAN").toString());
//				aa.add(u);
//			}

		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return aa;
	}

	@Override
	public List<ModelPerencanaaBb> getListPerencanaanBb(String id_pltu) {
		// TODO Auto-generated method stub
		List<ModelPerencanaaBb> aa = new ArrayList<ModelPerencanaaBb>();
		System.out.println("Dao Impl RKAP");
		try {
			
			Connection con = sessionFactory.getCurrentSession().connection();
			String sql = null;
			
			sql = "{call BBTRX.SETID_PLTU(?)}";
	        CallableStatement setnmkit = con.prepareCall(sql);
	        setnmkit.setString(1, id_pltu);
	        setnmkit.execute();
	        
			sql = "{? = call BBTRXPERENCANAAN.GETLISTRENCANABYKIT()}";
			CallableStatement cst = con.prepareCall(sql);
			cst.registerOutParameter(1,OracleTypes.CURSOR);
			cst.execute();

			ResultSet rset = (ResultSet) cst.getObject(1);
			while (rset.next()) {
				ModelPerencanaaBb u = new ModelPerencanaaBb();
				u.setId_plan(rset.getInt("id_plan"));
				u.setId_uraian(rset.getInt("id_uraian"));
				u.setId_unit(rset.getInt("id_unit"));
				u.setId_kategori(rset.getInt("id_kategori"));
				u.setId_pltu(rset.getInt("id_pltu"));
				u.setId_instansi(rset.getInt("id_instansi"));
				u.setSatuan(rset.getString("satuan").toString());
				u.setJan(rset.getInt("jan"));
				u.setFeb(rset.getInt("feb"));
				u.setMar(rset.getInt("mar"));
				u.setApr(rset.getInt("apr"));
				u.setMei(rset.getInt("mei"));
				u.setJun(rset.getInt("jun"));
				u.setJul(rset.getInt("jul"));
				u.setAgt(rset.getInt("agt"));
				u.setSept(rset.getInt("sept"));
				u.setOkt(rset.getInt("okt"));
				u.setNop(rset.getInt("nop"));
				u.setDes(rset.getInt("des"));
				u.setTahun(rset.getInt("tahun"));
				u.setTriw_satu(rset.getInt("triw_satu"));
				u.setTriw_dua(rset.getInt("triw_dua"));
				u.setTriw_tiga(rset.getInt("triw_tiga"));
				u.setTriw_empat(rset.getInt("triw_empat"));
				aa.add(u);
			}

		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return aa;
	}

	@Override
	public List<MasterPembangkit> getRkitall() {
		// TODO Auto-generated method stub
//		List<MasterPembangkit> aa = new ArrayList<MasterPembangkit>();
//		System.out.println("Dao Impl Pembangkit");
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			sql = "{? = call EPILOG.func_data(?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "KIT");
//			cst.setString(3, "");
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				MasterPembangkit u = new MasterPembangkit();
//				
//				u.setId_pltu(rset.getInt("id_pltu"));
//				u.setNama_pembangkit(rset.getString("nama_pembangkit"));
//				u.setNama_pic(rset.getString("nama_pic"));
//				u.setAlamat(rset.getString("alamat"));
//				u.setKepemilikan(rset.getString("kepemilikan"));
//				u.setLatitude(rset.getInt("latitude"));
//				u.setLongitude(rset.getInt("longitude"));
//				u.setWilayah(rset.getString("wilayah"));
//				u.setJenis_pembangkit(rset.getString("jenis_pembangkit"));
//				u.setTelp(rset.getString("telp"));
//				u.setDaya_terpasang(rset.getString("daya_terpasang"));
//				u.setSfc(rset.getString("sfc"));
//				u.setCapacity_factor(rset.getString("capacity_factor"));
//				u.setHeat_rate(rset.getString("heat_rate"));
//				u.setCreateby(rset.getString("createby"));
//				u.setCreatedate(rset.getDate("createdate"));
//				u.setUpdateby(rset.getString("updateby"));
//				u.setUpdatedate(rset.getDate("updatedate"));
//				u.setApp_access(rset.getString("app_access"));
//				
//				
//				aa.add(u);
//			}
//
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return aa;
		return null;
	}

	@Override
	public List<MasterPemasok> getpemasokall() {
		// TODO Auto-generated method stub
//		List<MasterPemasok> aa = new ArrayList<MasterPemasok>();
//		System.out.println("Dao Impl Pemasok");
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			sql = "{? = call EPILOG.func_data(?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "PEMASOK");
//			cst.setString(3, "");
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				MasterPemasok u = new MasterPemasok();
//				u.setId_pjbb(rset.getInt("id_pjbb"));
//				u.setId_jenis_kontrak(rset.getInt("id_jenis_kontrak"));
//				u.setId_pemasok(rset.getInt("id_pemasok"));
//				u.setId_pltu(rset.getInt("id_pltu"));
//				u.setTahun(rset.getInt("tahun"));
//				u.setNo_pjbb(rset.getString("no_pjbb"));
//				u.setTgl_pjbb(rset.getDate("tgl_pjbb"));
//				u.setLot(rset.getInt("lot"));
//				u.setKeb_pertahun(rset.getInt("keb_pertahun"));
//				u.setVol_pjbb(rset.getInt("vol_pjbb_tahun"));
//				u.setVol_pjbb_tahun(rset.getInt("vol_pjbb_tahun"));
//				u.setHarga_rp_ton(rset.getInt("harga_rp_ton"));
//				u.setHarga_penyesuaian(rset.getInt("harga_penyesuaian"));
//				u.setRp_nilai_kontrak(rset.getInt("rp_nilai_kontrak"));
//				u.setKalori(rset.getInt("kalori"));
//				u.setMasa_berlaku(rset.getString("masa_berlaku"));
//				u.setKeterangan(rset.getString("keterangan"));
//				u.setJenis_pengiriman(rset.getString("jenis_pengiriman"));
//				u.setJaminan_bank(rset.getString("jaminan_bank"));
//				u.setCreateby(rset.getString("createby"));
//				u.setCreatedate(rset.getDate("createdate"));
//				u.setUpdateby(rset.getString("updateby"));
//				u.setUpdatedate(rset.getDate("updatedate"));
//				u.setApp_access(rset.getString("app_access"));
//
//				aa.add(u);
//			}
//
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return aa;
		return null;
	}

	@Override
	public List<MasterJadwal> getjadwalall() {
		// TODO Auto-generated method stub
//		List<MasterJadwal> aa = new ArrayList<MasterJadwal>();
//		System.out.println("Dao Impl Jadwal");
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			sql = "{? = call EPILOG.func_data(?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "JADWAL");
//			cst.setString(3, "");
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				MasterJadwal u = new MasterJadwal();
//				u.setId_jadwal(rset.getInt("id_jadwal"));
//				u.setId_pasokan(rset.getInt("id_pasokan"));
//				u.setId_pemasok(rset.getInt("id_pemasok"));
//				u.setId_transportir(rset.getInt("id_transportir"));
//				u.setId_bahan_bakar(rset.getInt("id_bahan_bakar"));
//				u.setId_pltu(rset.getInt("id_pltu"));
//				u.setId_rakor(rset.getInt("id_rakor"));
//				u.setTgl_ta(rset.getDate("tgl_ta"));
//				u.setTgl_td(rset.getDate("tgl_td"));
//				u.setVolume(rset.getInt("volume"));
//				u.setCreateby(rset.getString("createby"));
//				u.setCreatedate(rset.getDate("createdate"));
//				u.setUpdateby(rset.getString("updateby"));
//				u.setUpdatedate(rset.getDate("updatedate"));
//				u.setApp_access(rset.getString("app_access"));
//
//				aa.add(u);
//			}
//
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return aa;
		return null;
	}

	@Override
	public List<RakorPKS> getrakorall() {
		// TODO Auto-generated method stub
//		List<RakorPKS> aa = new ArrayList<RakorPKS>();
//		System.out.println("Dao Impl rakor");
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			sql = "{? = call EPILOG.func_data(?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "RAKOR");
//			cst.setString(3, "");
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				RakorPKS u = new RakorPKS();
//				u.setId_rakor(rset.getInt("id_rakor"));
//				u.setTanggal(rset.getDate("tanggal"));
//				u.setTempat(rset.getString("tempat"));
//				u.setAlamat(rset.getString("alamat"));
//				u.setKeterangan(rset.getString("keterangan"));
//				u.setAgenda(rset.getString("agenda"));
//
//				aa.add(u);
//			}
//
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return aa;
		return null;
	}

	@Override
	public List<MasterSurveyor> getsureveyorall() {
		// TODO Auto-generated method stub
//		List<MasterSurveyor> aa = new ArrayList<MasterSurveyor>();
//		System.out.println("Dao Impl Surveyor");
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			sql = "{? = call EPILOG.func_data(?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "SURVEYOR");
//			cst.setString(3, "");
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				MasterSurveyor u = new MasterSurveyor();
//				u.setId_surveyor(rset.getInt("id_surveyor"));
//				u.setNama_surveyor(rset.getString("nama_surveyor"));
//				u.setNo_kerjasama(rset.getString("no_kerjasama"));
//				u.setTanggal(rset.getDate("tanggal"));
//				u.setTelp(rset.getString("telp"));
//				u.setAlamat(rset.getString("alamat"));
//				u.setPic(rset.getString("pic"));
//				u.setKeterangan(rset.getString("keterangan"));
//				u.setNo_kontrak(rset.getString("no_kontrak"));
//				u.setCreateby(rset.getString("createby"));
//				u.setCreatedate(rset.getDate("createdate"));
//				u.setUpdateby(rset.getString("updateby"));
//				u.setUpdatedate(rset.getDate("updatedate"));
//				u.setApp_access(rset.getString("app_access"));
//				aa.add(u);
//			}
//
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return aa;
		return null;
	}

	@Override
	public List<MasterTransportir> gettransall() {
		// TODO Auto-generated method stub
//		List<MasterTransportir> aa = new ArrayList<MasterTransportir>();
//		System.out.println("Dao Impl Transportir");
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			sql = "{? = call EPILOG.func_data(?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "TRANSPORTIR");
//			cst.setString(3, "");
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				MasterTransportir u = new MasterTransportir();
//				u.setId_transportir(rset.getInt("id_transportir"));
//				u.setNama_transportir(rset.getString("nama_transportir"));
//				u.setAlamat(rset.getString("alamat").toString());
//				u.setTelp(rset.getString("telp"));
//				u.setPic(rset.getString("pic"));
//				u.setNama_transport(rset.getString("nama_transport"));
//				u.setJenis_transport(rset.getString("jenis_transport"));
//				u.setKode_transport(rset.getString("kode_transport"));
//				u.setJumlah_kapal(rset.getInt("jumlah_kapal"));
//				u.setSpec_kapal(rset.getString("spec_kapal"));
//				u.setCreateby(rset.getString("createby"));
//				u.setCreatedate(rset.getDate("createdate"));
//				u.setUpdateby(rset.getString("updateby"));
//				u.setUpdatedate(rset.getDate("updatedate"));
//				u.setApp_access(rset.getString("app_access"));
//
//				aa.add(u);
//			}
//
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return aa;
		return null;
	}

	@Override
	public List<MasterPasokan> getpasokanall() {
		// TODO Auto-generated method stub
//		List<MasterPasokan> aa = new ArrayList<MasterPasokan>();
//		System.out.println("Dao Impl Pasokan");
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			sql = "{? = call EPILOG.func_data(?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "PASOKAN");
//			cst.setString(3, "");
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				MasterPasokan u = new MasterPasokan();
//				u.setId_pasokan(rset.getInt("id_pasokan"));
//				u.setId_pemasok(rset.getInt("id_pemasok"));
//				u.setId_pjbb(rset.getInt("id_pjbb"));
//				u.setId_pltu(rset.getInt("id_pltu"));
//				u.setId_rakor(rset.getInt("id_rakor"));
//				u.setVolume(rset.getInt("volume"));
//				u.setSatuan(rset.getString("satuan"));
//				u.setTgl_eta(rset.getDate("tgl_eta"));
//				u.setTgl_etd(rset.getDate("tgl_etd"));
//				u.setBulan_tahun(rset.getString("bulan_tahun"));
//				u.setKeterangan(rset.getString("keterangan"));
//				u.setTgl_bongkar(rset.getDate("tgl_bongkar"));
//				u.setCreateby(rset.getString("createby"));
//				u.setCreatedate(rset.getDate("createdate"));
//				u.setUpdateby(rset.getString("updateby"));
//				u.setUpdatedate(rset.getDate("updatedate"));
//				u.setApp_access(rset.getString("app_access"));
//				aa.add(u);
//			}
//
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return aa;
		return null;
	}

	@Override
	public void saveMasterKit(MasterAllMembers masterallmembers, String codeMaster, String crud) {
		// TODO Auto-generated method stub
		System.out.println("PACKAGE BBTRX.INSERTMASTERBB");
		
		try {
			if (codeMaster.equals("PEMBANGKIT")){
				Connection conn = sessionFactory.getCurrentSession().connection();
				String sql = null;
				
				if (crud.equals("UPDATE")){
					sql = "{call BBTRX.SETID_PLTU(?)}";
			        CallableStatement setidkit = conn.prepareCall(sql);
			        setidkit.setInt(1, masterallmembers.getId_pltu());
			        setidkit.execute();
					}
					
					if (crud.equals("DELETE")){
						sql = "{call BBTRX.SETID_PLTU(?)}";
				        CallableStatement setidkit = conn.prepareCall(sql);
				        setidkit.setInt(1, masterallmembers.getId_pltu());
				        setidkit.execute();
					}
				
				
				
				sql = "{call BBTRX.SETNAMA_PEMBANGKIT(?)}";
		        CallableStatement setnmkit = conn.prepareCall(sql);
		        setnmkit.setString(1, masterallmembers.getNama_pembangkit());
		        setnmkit.execute();
		        
		        sql = "{call BBTRX.SETNAMA_PIC(?)}";
		        CallableStatement setnmpic = conn.prepareCall(sql);
		        setnmpic.setString(1, masterallmembers.getNama_pic());
		        setnmpic.execute();
		        
		        sql = "{call BBTRX.SETALAMAT(?)}";
		        CallableStatement setalamat = conn.prepareCall(sql);
		        setalamat.setString(1, masterallmembers.getAlamat());
		        setalamat.execute();
		        
		        sql = "{call BBTRX.SETKEPEMILIKAN(?)}";
		        CallableStatement setpemilik = conn.prepareCall(sql);
		        setpemilik.setString(1, masterallmembers.getKepemilikan());
		        setpemilik.execute();
		        
		        sql = "{call BBTRX.SETLATITUDE(?)}";
		        CallableStatement setlatitude = conn.prepareCall(sql);
		        setlatitude.setString(1, masterallmembers.getLatitude());
		        setlatitude.execute();
		        
		        sql = "{call BBTRX.SETLONGITUDE(?)}";
		        CallableStatement setlongitude = conn.prepareCall(sql);
		        setlongitude.setString(1, masterallmembers.getLongitude());
		        setlongitude.execute();
		        
		        sql = "{call BBTRX.SETWILAYAH(?)}";
		        CallableStatement setwilayah = conn.prepareCall(sql);
		        setwilayah.setString(1, masterallmembers.getWilayah());
		        setwilayah.execute();
		        
		        sql = "{call BBTRX.SETJENIS_PEMBANGKIT(?)}";
		        CallableStatement setjeniskit = conn.prepareCall(sql);
		        setjeniskit.setString(1, masterallmembers.getJenis_pembangkit());
		        setjeniskit.execute();
		        
		        sql = "{call BBTRX.SETTELP(?)}";
		        CallableStatement settelp = conn.prepareCall(sql);
		        settelp.setString(1, masterallmembers.getTelp());
		        settelp.execute();
		        
		        sql = "{call BBTRX.SETDAYA_TERPASANG(?)}";
		        CallableStatement setdaya = conn.prepareCall(sql);
		        setdaya.setString(1, masterallmembers.getDaya_terpasang());
		        setdaya.execute();
		        
		        sql = "{call BBTRX.SETSFC(?)}";
		        CallableStatement setsfc = conn.prepareCall(sql);
		        setsfc.setString(1, masterallmembers.getSfc());
		        setsfc.execute();
		        
		        sql = "{call BBTRX.SETCAPACITY_FACTOR(?)}";
		        CallableStatement setcapacity = conn.prepareCall(sql);
		        setcapacity.setString(1, masterallmembers.getCapacity_factor());
		        setcapacity.execute();
		        
		        sql = "{call BBTRX.SETHEAT_RATE(?)}";
		        CallableStatement setheat = conn.prepareCall(sql);
		        setheat.setString(1, masterallmembers.getHeat_rate());
		        setheat.execute();
		        
		        sql = "{call BBTRX.SETCREATEBY(?)}";
		        CallableStatement setcreateby = conn.prepareCall(sql);
		        setcreateby.setString(1, masterallmembers.getCreateby());
		        setcreateby.execute();
		        
		        sql = "{call BBTRX.SETUPDATEBY(?)}";
		        CallableStatement setupdateby = conn.prepareCall(sql);
		        setupdateby.setString(1, masterallmembers.getUpdateby());
		        setupdateby.execute();
		        
		        sql = "{call BBTRX.SETAPP_ACCESS(?)}";
		        CallableStatement setapp = conn.prepareCall(sql);
		        setapp.setString(1, masterallmembers.getApp_access());
		        setapp.execute();
				
		        sql = "{? = call BBTRX.INSERTMASTERBB(?,?)}";
		        CallableStatement cst = conn.prepareCall(sql);
		        cst.setString(2, codeMaster);
		        cst.setString(3, crud);
		        cst.registerOutParameter(1,OracleTypes.NUMBER);
		        cst.execute();
				
				cst.close();
				conn.close();
			}else if (codeMaster.equals("PEMASOK")){
				Connection conn = sessionFactory.getCurrentSession().connection();
				String sql = null;
				
				if (crud.equals("UPDATE")){
				sql = "{call BBTRX.SETID_PEMASOK(?)}";
		        CallableStatement setidsok = conn.prepareCall(sql);
		        setidsok.setInt(1, masterallmembers.getId_pemasok());
		        setidsok.execute();
				}
				
				if (crud.equals("DELETE")){
					sql = "{call BBTRX.SETID_PEMASOK(?)}";
			        CallableStatement setidsok = conn.prepareCall(sql);
			        setidsok.setInt(1, masterallmembers.getId_pemasok());
			        setidsok.execute();
				}
				
				sql = "{call BBTRX.SETPEMASOK(?)}";
		        CallableStatement setpemasok = conn.prepareCall(sql);
		        setpemasok.setString(1, masterallmembers.getPemasok());
		        setpemasok.execute();
		        
		        sql = "{call BBTRX.SETALAMAT(?)}";
		        CallableStatement setalamat = conn.prepareCall(sql);
		        setalamat.setString(1, masterallmembers.getAlamat());
		        setalamat.execute();
		        
		        sql = "{call BBTRX.SETTLP(?)}";
		        CallableStatement settlp = conn.prepareCall(sql);
		        settlp.setString(1, masterallmembers.getTelp());
		        settlp.execute();
		        
		        sql = "{call BBTRX.SETFAX(?)}";
		        CallableStatement setfax = conn.prepareCall(sql);
		        setfax.setString(1, masterallmembers.getFax());
		        setfax.execute();
		        
		        sql = "{call BBTRX.SETEMAIL(?)}";
		        CallableStatement setemail = conn.prepareCall(sql);
		        setemail.setString(1, masterallmembers.getEmail());
		        setemail.execute();
		        
		        sql = "{call BBTRX.SETPIC_PRESDIR(?)}";
		        CallableStatement setpresdir = conn.prepareCall(sql);
		        setpresdir.setString(1, masterallmembers.getPic_presdir());
		        setpresdir.execute();
		        
		        sql = "{call BBTRX.SETPIC_DIR_MARKETING(?)}";
		        CallableStatement setdirmarket = conn.prepareCall(sql);
		        setdirmarket.setString(1, masterallmembers.getPic_dir_marketing());
		        setdirmarket.execute();
		        
		        sql = "{call BBTRX.SETPIC_MAN_OPR(?)}";
		        CallableStatement setmanopr = conn.prepareCall(sql);
		        setmanopr.setString(1, masterallmembers.getPic_man_opr());
		        setmanopr.execute();
		        
		        sql = "{call BBTRX.SETSTATUS_PEMASOK(?)}";
		        CallableStatement setstatussok = conn.prepareCall(sql);
		        setstatussok.setString(1, masterallmembers.getStatus_pemasok());
		        setstatussok.execute();
		        
		        sql = "{call BBTRX.SETNAMA_TAMBANG(?)}";
		        CallableStatement setnmtambang = conn.prepareCall(sql);
		        setnmtambang.setString(1, masterallmembers.getNama_tambang());
		        setnmtambang.execute();
		        
		        sql = "{call BBTRX.SETPRODUKSI(?)}";
		        CallableStatement setproduksi = conn.prepareCall(sql);
		        setproduksi.setString(1, masterallmembers.getProduksi());
		        setproduksi.execute();
		        
		        sql = "{call BBTRX.SETLOADING_PORT(?)}";
		        CallableStatement setloadport = conn.prepareCall(sql);
		        setloadport.setString(1, masterallmembers.getLoading_port());
		        setloadport.execute();
		        
		        sql = "{call BBTRX.SETFASILITAS_LOADING(?)}";
		        CallableStatement setfasloading = conn.prepareCall(sql);
		        setfasloading.setString(1, masterallmembers.getFasilitas_loading());
		        setfasloading.execute();
		        
		        sql = "{call BBTRX.SETJARAK_HAULING(?)}";
		        CallableStatement setjarakhauling = conn.prepareCall(sql);
		        setjarakhauling.setString(1, masterallmembers.getJarak_hauling());
		        setjarakhauling.execute();
		        
		        sql = "{call BBTRX.SETFLAG_BLACKLIST(?)}";
		        CallableStatement setfb = conn.prepareCall(sql);
		        setfb.setString(1, masterallmembers.getFlag_blacklist());
		        setfb.execute();
		        
		        sql = "{call BBTRX.SETSTATUS_AKTIF(?)}";
		        CallableStatement setsa = conn.prepareCall(sql);
		        setsa.setString(1, masterallmembers.getStatus_aktif());
		        setsa.execute();
				
		        sql = "{call BBTRX.SETKETERANGAN(?)}";
		        CallableStatement setket = conn.prepareCall(sql);
		        setket.setString(1, masterallmembers.getKeterangan());
		        setket.execute();
		        
		        sql = "{call BBTRX.SETID_PUSAT(?)}";
		        CallableStatement setidpusat = conn.prepareCall(sql);
		        setidpusat.setInt(1, masterallmembers.getId_pusat());
		        setidpusat.execute();
				
		        sql = "{call BBTRX.SETSTATUS(?)}";
		        CallableStatement setstatus = conn.prepareCall(sql);
		        setstatus.setString(1, masterallmembers.getStatus());
		        setstatus.execute();
		        
		        sql = "{call BBTRX.SETCREATEBY(?)}";
		        CallableStatement setcreateby = conn.prepareCall(sql);
		        setcreateby.setString(1, masterallmembers.getCreateby());
		        setcreateby.execute();
		        
		        sql = "{call BBTRX.SETUPDATEBY(?)}";
		        CallableStatement setupdateby = conn.prepareCall(sql);
		        setupdateby.setString(1, masterallmembers.getUpdateby());
		        setupdateby.execute();
		        
		        sql = "{call BBTRX.SETAPP_ACCESS(?)}";
		        CallableStatement setapp = conn.prepareCall(sql);
		        setapp.setString(1, masterallmembers.getApp_access());
		        setapp.execute();
		        
		        
		        sql = "{? = call BBTRX.INSERTMASTERBB(?,?)}";
		        CallableStatement cst = conn.prepareCall(sql);
		        cst.setString(2, codeMaster);
		        cst.setString(3, crud);
		        cst.registerOutParameter(1,OracleTypes.NUMBER);
		        cst.execute();
				
				cst.close();
				conn.close();
			}else if (codeMaster.equals("TRANSPORTIR")){
				Connection conn = sessionFactory.getCurrentSession().connection();
				String sql = null;
				
				if (crud.equals("UPDATE")){
					sql = "{call BBTRX.SETID_TRANSPORTIR(?)}";
			        CallableStatement setidtrans = conn.prepareCall(sql);
			        setidtrans.setInt(1, masterallmembers.getId_transportir());
			        setidtrans.execute();
					}
					
					if (crud.equals("DELETE")){
						sql = "{call BBTRX.SETID_TRANSPORTIR(?)}";
				        CallableStatement setidtrans = conn.prepareCall(sql);
				        setidtrans.setInt(1, masterallmembers.getId_transportir());
				        setidtrans.execute();
					}
				
				
		        
		        sql = "{call BBTRX.SETNAMA_TRANSPORTIR(?)}";
		        CallableStatement setnmtrans = conn.prepareCall(sql);
		        setnmtrans.setString(1, masterallmembers.getNama_transportir());
		        setnmtrans.execute();
		        
		        sql = "{call BBTRX.SETALAMAT(?)}";
		        CallableStatement setalamat = conn.prepareCall(sql);
		        setalamat.setString(1, masterallmembers.getAlamat());
		        setalamat.execute();
		        
		        sql = "{call BBTRX.SETTLP(?)}";
		        CallableStatement settelp = conn.prepareCall(sql);
		        settelp.setString(1, masterallmembers.getTelp());
		        settelp.execute();
		        
		        sql = "{call BBTRX.SETPIC(?)}";
		        CallableStatement setpic = conn.prepareCall(sql);
		        setpic.setString(1, masterallmembers.getPic());
		        setpic.execute();
		        
		        sql = "{call BBTRX.SETNAMA_TRANSPORT(?)}";
		        CallableStatement setnmtransport = conn.prepareCall(sql);
		        setnmtransport.setString(1, masterallmembers.getNama_transport());
		        setnmtransport.execute();
		        
		        sql = "{call BBTRX.SETJENIS_TRANSPORT(?)}";
		        CallableStatement setjenistrans = conn.prepareCall(sql);
		        setjenistrans.setString(1, masterallmembers.getJenis_transport());
		        setjenistrans.execute();
		        
		        sql = "{call BBTRX.SETKODE_TRANSPORT(?)}";
		        CallableStatement setkodetrans = conn.prepareCall(sql);
		        setkodetrans.setString(1, masterallmembers.getKode_transport());
		        setkodetrans.execute();
				
		        sql = "{call BBTRX.SETJUMLAH_KAPAL(?)}";
		        CallableStatement setjumkapal = conn.prepareCall(sql);
		        setjumkapal.setString(1, masterallmembers.getJumlah_kapal());
		        setjumkapal.execute();
		        
		        
		        sql = "{call BBTRX.SETSPEC_KAPAL(?)}";
		        CallableStatement setspekkapal = conn.prepareCall(sql);
		        setspekkapal.setString(1, masterallmembers.getSpec_kapal());
		        setspekkapal.execute();
		        
		        sql = "{call BBTRX.SETCREATEBY(?)}";
		        CallableStatement setcreateby = conn.prepareCall(sql);
		        setcreateby.setString(1, masterallmembers.getCreateby());
		        setcreateby.execute();
		        
		        sql = "{call BBTRX.SETUPDATEBY(?)}";
		        CallableStatement setupdateby = conn.prepareCall(sql);
		        setupdateby.setString(1, masterallmembers.getUpdateby());
		        setupdateby.execute();
		        
		        sql = "{call BBTRX.SETAPP_ACCESS(?)}";
		        CallableStatement setapp = conn.prepareCall(sql);
		        setapp.setString(1, masterallmembers.getApp_access());
		        setapp.execute();
				
		        sql = "{? = call BBTRX.INSERTMASTERBB(?,?)}";
		        CallableStatement cst = conn.prepareCall(sql);
		        cst.setString(2, codeMaster);
		        cst.setString(3, crud);
		        cst.registerOutParameter(1,OracleTypes.NUMBER);
		        cst.execute();
				
				cst.close();
				conn.close();
			}
			else if (codeMaster.equals("SURVEYOR")){
				Connection conn = sessionFactory.getCurrentSession().connection();
				String sql = null;
				
				if (crud.equals("UPDATE")){
					sql = "{call BBTRX.SETID_SURVEYOR(?)}";
			        CallableStatement setidveyor = conn.prepareCall(sql);
			        setidveyor.setInt(1, masterallmembers.getId_surveyor());
			        setidveyor.execute();
					}
					
					if (crud.equals("DELETE")){
						sql = "{call BBTRX.SETID_SURVEYOR(?)}";
				        CallableStatement setidveyor = conn.prepareCall(sql);
				        setidveyor.setInt(1, masterallmembers.getId_surveyor());
				        setidveyor.execute();
					}
				
				
		        
		        sql = "{call BBTRX.SETNAMA_SURVEYOR(?)}";
		        CallableStatement setnmveyor = conn.prepareCall(sql);
		        setnmveyor.setString(1, masterallmembers.getNama_surveyor());
		        setnmveyor.execute();
		        
		        sql = "{call BBTRX.SETNO_KERJASAMA(?)}";
		        CallableStatement setnokerjasama = conn.prepareCall(sql);
		        setnokerjasama.setString(1, masterallmembers.getNo_kerjasama());
		        setnokerjasama.execute();
		        
		        sql = "{call BBTRX.SETTANGGAL(?)}";
		        CallableStatement settgl = conn.prepareCall(sql);
		        settgl.setString(1, masterallmembers.getTanggal());
		        System.out.println("tgl di dao" + masterallmembers.getTanggal());
		        settgl.execute();
		        
		        sql = "{call BBTRX.SETPIC(?)}";
		        CallableStatement setpic = conn.prepareCall(sql);
		        setpic.setString(1, masterallmembers.getPic());
		        setpic.execute();
		        
		        sql = "{call BBTRX.SETNO_KONTRAK(?)}";
		        CallableStatement setnokontrak = conn.prepareCall(sql);
		        setnokontrak.setString(1, masterallmembers.getNo_kontrak());
		        setnokontrak.execute();
		        
		        sql = "{call BBTRX.SETTELP(?)}";
		        CallableStatement settelp = conn.prepareCall(sql);
		        settelp.setString(1, masterallmembers.getTelp());
		        System.out.println("telp: " + masterallmembers.getTelp());
		        settelp.execute();
		        
		        sql = "{call BBTRX.SETALAMAT(?)}";
		        CallableStatement setalamat = conn.prepareCall(sql);
		        setalamat.setString(1, masterallmembers.getAlamat());
		        setalamat.execute();
		        
		        sql = "{call BBTRX.SETKETERANGAN(?)}";
		        CallableStatement setket = conn.prepareCall(sql);
		        setket.setString(1, masterallmembers.getKeterangan());
		        setket.execute();
		        
		        sql = "{call BBTRX.SETCREATEBY(?)}";
		        CallableStatement setcreateby = conn.prepareCall(sql);
		        setcreateby.setString(1, masterallmembers.getCreateby());
		        setcreateby.execute();
		        
		        sql = "{call BBTRX.SETUPDATEBY(?)}";
		        CallableStatement setupdateby = conn.prepareCall(sql);
		        setupdateby.setString(1, masterallmembers.getUpdateby());
		        setupdateby.execute();
		        
		        sql = "{call BBTRX.SETAPP_ACCESS(?)}";
		        CallableStatement setapp = conn.prepareCall(sql);
		        setapp.setString(1, masterallmembers.getApp_access());
		        setapp.execute();
				
		        sql = "{? = call BBTRX.INSERTMASTERBB(?,?)}";
		        CallableStatement cst = conn.prepareCall(sql);
		        cst.setString(2, codeMaster);
		        cst.setString(3, crud);
		        cst.registerOutParameter(1,OracleTypes.NUMBER);
		        cst.execute();
				
				cst.close();
				conn.close();
			}
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}	
	}

	@Override
	public void updateMasterKit(MasterAllMembers masterallmembers) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<ModelPengendalianBb> getListPengendalianBb(String id_pltu,String codeCtl) {
		// TODO Auto-generated method stub
		List<ModelPengendalianBb> aa = new ArrayList<ModelPengendalianBb>();
		System.out.println("codeCtl: " + codeCtl);
		System.out.println("id pltu: " + id_pltu);
		try {
			@SuppressWarnings("deprecation")
			Connection con = sessionFactory.getCurrentSession().connection();
			String sql = null;
			
			sql = "{call bbtrxpengendalian.SETID_PLTU(?)}";
	        CallableStatement idpltu = con.prepareCall(sql);
	        idpltu.setString(1, id_pltu);
	        idpltu.execute();
			
			sql = "{? = call bbtrxpengendalian.GETLISTPENGENDALIANBY(?)}";
			CallableStatement cst = con.prepareCall(sql);
			cst.setString(2, codeCtl);
			cst.registerOutParameter(1,OracleTypes.CURSOR);
			cst.execute();

			ResultSet rset = (ResultSet) cst.getObject(1);
			
			
			while (rset.next()) {
				if (codeCtl.equals("JADWAL")){
				System.out.println("JADWAL dao");
				ModelPengendalianBb u = new ModelPengendalianBb();
				u.setId_bahan_bakar(rset.getInt("id_bahan_bakar"));
				System.out.println("id pltu" + rset.getInt("id_pltu"));
				u.setId_pasokan(rset.getInt("id_pasokan"));
				u.setId_pemasok(rset.getInt("id_pemasok"));
				u.setId_pltu(rset.getInt("id_pltu"));
				u.setId_rakor(rset.getInt("id_rakor"));
				u.setId_transportir(rset.getInt("id_transportir"));
				u.setTgl_ta(rset.getString("tgl_ta"));
				u.setTgl_td(rset.getString("tgl_td"));
				u.setVolume(rset.getString("volume"));
				u.setId_jadwal(rset.getInt("id_jadwal"));
				u.setNo_rakor(rset.getString("no_rakor"));
				u.setBulan_tahun(rset.getString("bulan_tahun"));
				u.setTanggal(rset.getString("tanggal"));
				u.setTambahan("");
				aa.add(u);
				}else if (codeCtl.equals("PASOKAN")){
					System.out.println("PASOKAN dao");
					ModelPengendalianBb u = new ModelPengendalianBb();
					u.setBulan_tahun(rset.getString("bulan_tahun"));
					u.setId_pemasok(rset.getInt("id_pemasok"));
					u.setId_pjbb(rset.getInt("id_pjbb"));
					u.setId_pltu(rset.getInt("id_pltu"));
					u.setId_rakor(rset.getInt("id_rakor"));
					u.setKeterangan(rset.getString("keterangan"));
					u.setSatuan(rset.getString("satuan"));
					u.setTgl_ta(rset.getString("tgl_ta"));
					u.setTgl_td(rset.getString("tgl_td"));
					u.setVolume(rset.getString("volume"));
					u.setId_pasokan(rset.getInt("id_pasokan"));
					u.setTgl_bongkar(rset.getString("tgl_bongkar"));
					u.setNo_rakor(rset.getString("no_rakor"));
					aa.add(u);
					}
				else if (codeCtl.equals("RAKOR")){
					System.out.println("RAKOR dao");
					ModelPengendalianBb u = new ModelPengendalianBb();
					u.setId_rakor(rset.getInt("no_rakor"));
					u.setNo_rakor(rset.getString("no_rakor"));
					u.setAlamat(rset.getString("no_rakor"));
					u.setAgenda(rset.getString("no_rakor"));
					u.setTempat(rset.getString("no_rakor"));
					u.setTanggal(rset.getString("no_rakor"));
					u.setTambahan(rset.getString("no_rakor"));
					aa.add(u);
					}
				else if (codeCtl.equals("RAKORKONFIRM")){
					System.out.println("RAKORKONFIRM dao");
					ModelPengendalianBb u = new ModelPengendalianBb();
					u.setId_rakor_kon(rset.getInt("no_rakor"));
					u.setId_pemasok(rset.getInt("no_rakor"));
					u.setId_pltu(rset.getInt("no_rakor"));
					u.setNo_rakor(rset.getString("no_rakor"));
					u.setKeterangan(rset.getString("no_rakor"));
					u.setTanggal(rset.getString("no_rakor"));
					aa.add(u);
					}
			}

		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return aa;
	}
	
//	@Override
//	public List<BbHistoryMasterHistory> getHistoryAll(String tema) {
//		// TODO Auto-generated method stub
//		List<BbHistoryMasterHistory> histoIpp = new ArrayList<BbHistoryMasterHistory>();
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			String k = tema;
//			sql = "{? = call FUNC_HISTO (?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, k);
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			
//			while (rset.next()) {
//				BbHistoryMasterHistory histoIppSet = new BbHistoryMasterHistory();
//				histoIppSet.setTglterima(rset.getString("tglterima").toString());
//				histoIpp.add(histoIppSet);							}			
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return histoIpp;
//	}
//
//	@Override
//	public String getMaxRP() {
//		// TODO Auto-generated method stub
//		String histoIpp = null;
//		String tmp = "";
//		try {
//			
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;
//			String k = "EP";
//			sql = "{? = call FUNC_MAX (?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, k);
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			while (rset.next()) {
//				tmp = rset.getString("maxtglterima");
//				GWT.log("TMP DI HIBERNATE: " + tmp,null);
//			}			
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		return tmp;
//	}
//	
//	@Override
//	public List<BbEntryRencanaProduksi> getEntryRPAll(String tglTerimaFile, String tahapan) {
//		// TODO Auto-generated method stub
//		System.out.println("masuk dao");
//		List<BbEntryRencanaProduksi> entryRP = new ArrayList<BbEntryRencanaProduksi>();
//		try {
//			Connection con = sessionFactory.getCurrentSession().connection();
//			String sql = null;			
//			sql = "{? = call EPILOG.func_data (?,?)}";
//			CallableStatement cst = con.prepareCall(sql);
//			cst.setString(2, "RENPRO");
//			cst.setString(3, tglTerimaFile);
//			cst.registerOutParameter(1,OracleTypes.CURSOR);
//			cst.execute();
//
//			ResultSet rset = (ResultSet) cst.getObject(1);
//			
//			while (rset.next()) {
//				BbEntryRencanaProduksi entryRPSet = new BbEntryRencanaProduksi();
//				entryRPSet.setId_plan(rset.getInt("id"));
//				GWT.log("id plan: " + rset.getInt("id"));
//				entryRPSet.setId_uraian(rset.getInt("id_uraian"));
//				entryRPSet.setId_unit(rset.getInt("id_unit"));
//				entryRPSet.setId_kategori(rset.getInt("id_kategori"));
//				entryRPSet.setId_pltu(rset.getInt("id_pltu"));
//				entryRPSet.setId_instansi(rset.getInt("id_instansi"));
//				entryRPSet.setSatuan(rset.getString("satuan"));
//				entryRPSet.setJan(rset.getInt("jan"));
//				entryRPSet.setFeb(rset.getInt("feb"));
//				entryRPSet.setMar(rset.getInt("mar"));
//				entryRPSet.setApr(rset.getInt("apr"));
//				entryRPSet.setMei(rset.getInt("mei"));
//				entryRPSet.setJun(rset.getInt("jun"));
//				entryRPSet.setJul(rset.getInt("jul"));
//				entryRPSet.setAgt(rset.getInt("agt"));
//				entryRPSet.setSept(rset.getInt("sept"));
//				entryRPSet.setOkt(rset.getInt("okt"));
//				entryRPSet.setNop(rset.getInt("nop"));
//				entryRPSet.setDes(rset.getInt("des"));
//				entryRPSet.setTahun(rset.getInt("tahun"));
//				entryRPSet.setTriw_satu(rset.getInt("triw_satu"));
//				entryRPSet.setTriw_dua(rset.getInt("triw_dua"));
//				entryRPSet.setTriw_tiga(rset.getInt("triw_tiga"));
//				entryRPSet.setTriw_empat(rset.getInt("triw_empat"));
//				entryRP.add(entryRPSet);				
//
//			}
//
//			
//		} catch (Exception ex) {
//			ex.printStackTrace();
//		}
//		
//		return entryRP;
//	}
	
}
